package com.kevin.utility.entity;

/**
 * 通用的结果类型
 * 
 * @author Random.LJ
 * @Since 2015年1月29日
 * 
 */
public class CommonResult {
	
	private boolean success;
	private String message;
	private Object data;
	
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	public boolean isSuccess() {
		return success;
	}
	public void setSuccess(boolean success) {
		this.success = success;
	}
	public Object getData() {
		return data;
	}
	public void setData(Object data) {
		this.data = data;
	}
	public CommonResult(boolean result, String message){
		this.setSuccess(result);
		this.message = message;
	}
	public CommonResult(boolean result, String message, Object data){
		this.setSuccess(result);
		this.message = message;
		this.data = data;
	}
	public static CommonResult getFailResult(String msg){
		return new CommonResult(false, msg);
	}
	public static CommonResult getSucessResult( Object object){
		return new CommonResult(true, "操作成功", object);
	}
	public static CommonResult getSucessResult(String msg, Object object){
		return new CommonResult(true, msg, object);
	}
	public static CommonResult getSucessResult(String msg){
		return new CommonResult(true, msg);
	}
	public static CommonResult getSucessResult(){
		return new CommonResult(true, "操作成功");
	}
}
